#include "utils.h"

Utils::Utils()
{
	QDir dir;
#ifdef Q_WS_X11
	if (!dir.exists(QDir::homePath ()+"/.qalarm/")) dir.mkdir(QDir::homePath ()+"/.qalarm/");
	if (!dir.exists(QDir::homePath ()+"/.qalarm/data/")) dir.mkdir(QDir::homePath ()+"/.qalarm/data/");	
#endif	
}

bool Utils::changed = false; 

void Utils::saveFile(QString fileName, QString data)
{
	QFile file(fileName);	
	if (file.open(QIODevice::WriteOnly|QIODevice::Text)) {
  		file.write(data.toUtf8());
 	}	
}

QString Utils::readFile(QString fileName)
{
	QFile file(fileName);	
	file.open(QIODevice::ReadOnly|QIODevice::Text);
	QString data = QString::fromUtf8(file.readAll());	
	return data;
}
